package com.jy.api.payRes;

import com.jy.api.domain.Coupon;
import com.jy.api.domain.CouponType;
import lombok.Data;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class CouponDto {

   List<Dto> dtos = new ArrayList<>();

    int  totalPages;

    long totalElements;

   @Data
   public static  class  Dto {
       private String title;

       private String productName;

       /**
        * 有效结束日期
        */
       @Temporal(TemporalType.TIMESTAMP)
       private Date endTime;

       private long sendCount;


       private int expireDay;

       private String productId;


       private long useCount;

       private String logoURL;

       private String id;

       private Date addTime;

       private Date startTime;

       private String createName;

       private long limitCount;

       /**
        * 优惠券类型
        */
       @Enumerated(EnumType.STRING)
       private CouponType type;

       public Dto(Coupon coupon) {
           this.title = coupon.getTitle();
           this.productName = coupon.getProductName();
           this.endTime = coupon.getEndTime();
           this.sendCount = 0;
           this.useCount = 0;
           this.logoURL = coupon.getLogoURL();
           this.id = coupon.getId();
           this.addTime=coupon.getAddTime();
           this.startTime=coupon.getStartTime();
           this.createName=coupon.getCreateName();
           this.limitCount=coupon.getLimitCount();
           this.type = coupon.getType();
           this.expireDay = coupon.getExpireDay();
       }
   }












}
